home *** CD-ROM | disk | FTP | other *** search
- Path: kbad.eglin.af.mil!rpi!not-for-mail
- From: league@cs.UMD.EDU (Christopher League)
- Newsgroups: comp.lang.c++,comp.lang.c++.moderated
- Subject: Re: Enumerated type converted to pointer? Legal?
- Date: 9 Mar 1996 21:09:28 -0000
- Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: Dietmar.Kuehl@uni-konstanz.de
- Message-ID: <4hss28$4mj@netlab.cs.rpi.edu>
- References: <4hobji$mco@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: 08 Mar 1996 17:26:08 GMT
-
- {I stripped 'comp.std.c++' from the list of newsgroups: Please do NOT
- crosspost to other (moderated) newsgroups... -mod}
-
- In article <4hobji$mco@netlab.cs.rpi.edu> bstowers@pobox.com (Brad
- Stowers) writes:
- >
- > typedef enum { mdType1, mdType2, mdType3 } myType;
- >
- > void FooBar(int x, int* y, myType type = mdType1);
- >
- > main()
- > {
- > int x = 10;
- > int* y = &x;
- > FooBar(x, y, mdType2);
- > FooBar(x, mdType1);
- > } ^^^^^^^^^^^^^ should be a type error.
- >
-
- I think it definitely *should* be a type error, ESPECIALLY in the
- latest ANSI/ISO draft, in which functions can now be overloaded based
- solely on enumerated types. (i.e.-- (enum == int) no more).
-
- >I have verified that this happens on both Borland and Symantec compilers.
- >Can anyone verify it on Watcom and Microsoft for me?
-
- In the Unix world, g++ says
- foo.c: In function `int main ()':
- foo.c:17: incompatible types in argument passing
-
- But then, GNU is *usually* well ahead of the big PC compiler vendors
- on these things... (does Borland have 'bool' yet?)
-
- `Chris
- _____
- Christopher League league@cs.umd.edu
- University of Maryland http://www.cs.umd.edu/users/league
- Department of Computer Science PGP Public Key available
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-